<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
    <title>Document</title>
</head>
<body>
    
    <div id="app">
        <router-link to="/home">首页</router-link>
        <router-link to="/user">用户</router-link>
        
        <router-view></router-view>
    </div>

    <script>

        const Home = {template:`<div>这是首页</div>`}
        const User = {template:`<div>用户界面</div>`}

        let router = new VueRouter({
            routes:[
                {
                    path:"/home",
                    component:Home
                },
                {
                    path:"/user",
                    component:User
                }
            ]
        })

        new Vue({
            el:"#app",
            router:router
        })
    </script>
</body>
</html>